package com.mes.fixture.controller;

import com.mes.common.pojo.MESResult;
import com.mes.fixture.server.FixtureServer;
import com.mes.pojo.fixture.Fixture;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 张喆
 * @Company
 * @Description
 * @Time 2024/10/23 9:59
 */
@RestController
@CrossOrigin
@RequestMapping("/fixture")
public class FixtureController {
    @Autowired
    private FixtureServer fixtureServer;
    @GetMapping("/list")
    public MESResult getList(Fixture fixture, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer limit){
        return fixtureServer.queryAll(fixture,pageNum,limit);
    }
    @GetMapping("/export")
    public MESResult getExport(Fixture fixture, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer limit){
        return fixtureServer.getExport(fixture,pageNum,limit);
    }
    @GetMapping("/updateInfo")
    public MESResult getUpdateInfo(String fixtureId){
        return fixtureServer.queryById(fixtureId);
    }
    @GetMapping("/getUseList")
    public MESResult getUseList(String fixtureTypeId){
        return fixtureServer.queryByTypeId(fixtureTypeId);
    }
    @DeleteMapping("/delete")
    public MESResult delete(String fixtureId){
        return fixtureServer.delete(fixtureId);
    }
    @PutMapping("/update")
    public MESResult update(@RequestBody Fixture fixture){
        return fixtureServer.update(fixture);
    }
    @PostMapping("/insert")
    public MESResult insert(@RequestBody Fixture fixture){
        return fixtureServer.insert(fixture);
    }
}
